<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>美兰数据文化馆与图书馆</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }

    .layui-form-label {
        width: 180px;
    }

    .layui-input-block {
        margin-left: 210px;
    }

    #Images li {
        float: left;
        margin: 0.5%;
        overflow: hidden;
        width: 19%;
    }

    #Images li img {
        cursor: pointer;
        width: 100%;
    }

    #Images li .operate {
        background: #f4f5f9 none repeat scroll 0 0;
        display: block;
        height: 40px;
        width: 100%;
    }

    #Images li .operate .check {
        float: left;
        height: 18px;
        margin-left: 11px;
        padding: 11px 0;
        position: relative;
        width: 74%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] {
        width: 100%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] span {
        box-sizing: border-box;
        padding: 0 5px 0 25px;
        width: 100%;
    }

    #Images li .operate .check .layui-form-checkbox[lay-skin="primary"] i {
        left: 0;
        position: absolute;
        top: 0;
    }

    #Images li .operate .img_del {
        cursor: pointer;
        float: right;
        font-size: 22px !important;
        margin: 9px 11px 0 0;
    }

    #Images li .operate .img_del:hover {
        color: #f00;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" style="padding: 0px;">
            <form class="layui-form" lay-filter="component-form-element">
                <input type="hidden" id="producttid" name="producttid">
                <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-hash">
                    <ul class="layui-tab-title">
                        <li class="layui-this">基本信息</li>
                        <li>详细信息</li>
                        <li>图片信息</li>
                    </ul>
                    <div class="layui-tab-content" style="height: 580px;">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">序号</label>
                                            <div class="layui-input-block">
                                                <input type="number" min="0" id="serialnumer" name="serialnumer"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入序号"
                                                       oninput="value=value.replace(/[^\d]+/g,'')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">站内编号</label>
                                            <div class="layui-input-block">
                                                <div class="layui-input-inline" style="width: 38px;margin:0px;">
                                                    <input type="text" autocomplete="off" class="layui-input"
                                                           value="HN" name="display" disabled
                                                           style="background-color: #f5f7fa;">
                                                </div>
                                                <div class="layui-input-block" style="margin-left:38px;">
                                                    <input type="text" autocomplete="off" class="layui-input"
                                                           style="border-left: none;"
                                                           maxlength="5" oninput="value=value.replace(/[^\d]+/g,'')"
                                                           placeholder="请输入站内编号" name="stationnumber">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">资产编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="assetnumber" name="assetnumber"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入资产编号"
                                                       disabled>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">仪器设备名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="equipmentname" name="equipmentname"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入仪器设备名称"
                                                       disabled>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">规格型号</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="model" name="model" autocomplete="off"
                                                       class="layui-input" placeholder="请输入规格型号"
                                                       disabled>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">主要技术指标</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="technicalindex" name="technicalindex"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入主要技术指标"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">出厂编号</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="factorynumber" name="factorynumber"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入出厂编号"
                                                       onkeyup="this.value=this.value.replace(/[^\w-]/g,'');"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">产地/厂商</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="place" name="place" autocomplete="off"
                                                       class="layui-input" placeholder="请输入产地/厂商"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">价格(万)</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="price" name="price" autocomplete="off"
                                                       class="layui-input" placeholder="请输入价格(万)"
                                                       maxlength="9"
                                                       disabled onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,4})?).*$/g, '$1')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">购置日期</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="purchasedatestring" name="purchasedatestring"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入购置日期"
                                                       readonly="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">存放房间</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="storageroom" name="storageroom"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入存放房间"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">责任人</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="responsible" name="responsible"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入责任人"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">设备状况</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="status" name="status" autocomplete="off"
                                                       class="layui-input" placeholder="请输入设备状况"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">检定周期</label>
                                            <div class="layui-input-block">
                                                <div class="layui-input-inline" style="width: 85%;margin:0px;">
                                                    <input type="text" autocomplete="off" class="layui-input"
                                                           placeholder="请输入检定周期"
                                                           min="0"
                                                           maxlength="5" name="cycle" id="cycle"
                                                           oninput="value=value.replace(/^(0+)|[^\d]+/g,'')">
                                                </div>
                                                <div class="layui-input-inline"style="width: 15%;margin:0px;">
                                                    <input type="text" name="cycleyear" autocomplete="off" class="layui-input"
                                                           value="周期"
                                                           disabled
                                                           style="background-color: #f5f7fa;border-left: none;">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">检定单位</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="verificationunit" name="verificationunit"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入检定单位"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">检定/校准有效日期</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="calibrationdatestring"
                                                       name="calibrationdatestring"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入检定/校准有效日期"
                                                       readonly="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">溯源方式</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="sourcemode" name="sourcemode" autocomplete="off"
                                                       class="layui-input" placeholder="请输入溯源方式"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">是否需要校准</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="calibration" value="是" title="是" checked>
                                                <input type="radio" name="calibration" value="否" title="否">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">计划检送日期</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="submissiondatestring" name="submissiondatestring"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入计划检送日期"
                                                       readonly="">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">责任科室</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="responsibledep" name="responsibledep"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入责任科室"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">缺少资料</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="lackmaterial" name="lackmaterial"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入缺少资料"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">档号</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="reference" name="reference" autocomplete="off"
                                                       class="layui-input" placeholder="请输入档号"
                                                       onkeyup="this.value=this.value.replace(/[^\w-]/g,'');">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-row">
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">档案完整状态</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="completionstatus" name="completionstatus"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入档案完整状态"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">分析项目</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="analysisproject" name="analysisproject"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入分析项目"
                                                >
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">仪器类型</label>
                                            <div class="layui-input-block">
                                                <select name="type" lay-filter="aihao">
                                                    <option value="">请选择</option>
                                                    <option value="现场采样设备">现场采样设备</option>
                                                    <option value="前处理设备">前处理设备</option>
                                                    <option value="分析检测设备">分析检测设备</option>
                                                    <option value="便携式检测设备">便携式检测设备</option>
                                                    <option value="其他">其他</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">检定/校准费用(元)</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="calibrationcost" name="calibrationcost"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入检定/校准费用(元)"
                                                       maxlength="11"
                                                       onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">估算仪器维护/维修(元)</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="computedvalue" name="computedvalue"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入估算仪器维护/维修(元)"
                                                       maxlength="11"
                                                       onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">估算仪器维护/维修/耗材(元)</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="computedvalues" name="computedvalues"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入估算仪器维护/维修/耗材(元)"
                                                       maxlength="11"
                                                       onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">每年维护费用(元)</label>
                                            <div class="layui-input-block">
                                                <input type="text" id="maintenanceost" name="maintenanceost"
                                                       autocomplete="off"
                                                       class="layui-input" placeholder="请输入每年维护费用(元)"
                                                       maxlength="11"
                                                       onkeyup="value=value.replace(/[^\d]/g,'').replace(/^0{1,}/g,'')">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">使用频率</label>
                                            <div class="layui-input-block">
                                                <div class="layui-input-inline" style="width:35%;margin:0px;">
                                                    <select name="eachs" lay-filter="aihao">
                                                        <option value="">请选择</option>
                                                        <option value="每年">每年</option>
                                                        <option value="每月">每月</option>
                                                        <option value="每月">每月</option>
                                                    </select>
                                                </div>
                                                <div class="layui-input-inline" style="width: 50%;margin:0px;">
                                                    <input type="text" autocomplete="off" class="layui-input"
                                                           placeholder="请输入使用频率"
                                                           style="border-left: none;" min="0"
                                                           maxlength="9" name="usefrequency"
                                                           oninput="value=value.replace(/[^\d]+/g,'')">
                                                </div>
                                                <div class="layui-input-inline" style="width: 15%;margin:0px;">
                                                    <input type="text" autocomplete="off" class="layui-input"
                                                           value="次数"
                                                           disabled
                                                           style="background-color: #f5f7fa;border-left: none;">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">使用状态</label>
                                            <div class="layui-input-block">
<%--                                                <input type="text" id="usagestatus" name="usagestatus"--%>
<%--                                                       autocomplete="off"--%>
<%--                                                       class="layui-input" placeholder="请输入使用状态"--%>
<%--                                                disabled>--%>
                                                <select name="usagestatus" lay-filter="aihao">
                                                    <option value="">请选择</option>
                                                    <option value="良好">良好</option>
                                                    <option value="经常故障">经常故障</option>
                                                    <option value="停用">停用</option>
                                                    <option value="维修中">维修中</option>
                                                    <option value="尚未启用">尚未启用</option>
                                                    <option value="出借">出借</option>
                                                    <option value="其他">其他</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">仪器是否还存在</label>
                                            <div class="layui-input-block">
                                                <input type="checkbox" name="exist" lay-skin="switch" lay-text="是|否"
                                                       checked
                                                       lay-filter="switchexist">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">将来是否还使用</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="alsoused" value="是" title="是" checked>
                                                <input type="radio" name="alsoused" value="否" title="否">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-col-md6">
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">停用原因</label>
                                            <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="stopusingreason"
                                                  placeholder="请输入停用原因"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">科室反馈意见</label>
                                            <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="feedback"
                                                  placeholder="请输入科室反馈意见"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">其他需要说明的情况</label>
                                            <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="other"
                                                  placeholder="请输入其他需要说明的情况"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item">
                                        <div class="layui-col-xs11">
                                            <label class="layui-form-label">备注</label>
                                            <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="remarks"
                                                  placeholder="请输入备注"></textarea>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="layui-tab-item">
                            <input type=hidden id="image" name=image>
                            <blockquote class="layui-elem-quote news_search">
                                <div class="layui-inline">
                                    <input type="checkbox" name="selectAll" id="selectAll" lay-filter="selectAll"
                                           lay-skin="primary" title="全选">
                                </div>
                                <div class="layui-inline" style="margin-right:10px">
                                    <a class="layui-btn layui-btn-sm layui-btn-danger batchDel">批量删除</a>
                                </div>
                                <div class="layui-inline">
                                    <a class="layui-btn layui-btn-sm uploadNewImg"><i class="layui-icon"></i>上传图片</a>
                                </div>
                            </blockquote>
                            <ul class="layer-photos-demo" id="Images"></ul>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-footer" style="left: 0;padding: 0px;">
                        <button class="layui-btn" lay-submit lay-filter="*" id="pushButton">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script>
    function child(id){
        layui.use(['form', 'laydate', 'upload'], function () {
            var $ = layui.$
                , form = layui.form
                , laydate = layui.laydate
                , layer = layui.layer,
                upload = layui.upload;

            $.ajax({
                type: "post",
                url: "<%=request.getContextPath()%>/rest/rfid/getOne",
                data: "id=" + id,
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#assetnumber").val( data.data[0].assetNumber)
                    $("#equipmentname").val( data.data[0].name)
                    $("#model").val( data.data[0].model)
                    $("#price").val( data.data[0].value)
                    // $("#usagestatus").val( data.data[0].usage)
                }
            });

            $("#producttid").val(id)

            var date = new Date();
            //获取当前年
            var year = date.getFullYear();
            //获取当前月
            var month = date.getMonth() + 1;
            //获取当前日
            var date = date.getDate();
            var now = year + '-' + p(month) + "-" + p(date);

            function p(s) {
                return s < 10 ? '0' + s : s;
            }

            //日期
            laydate.render({
                elem: '#purchasedatestring',
                value: now,
                btns: ['now', 'confirm'],
                theme: 'molv',
                calendar: true
            });

            //日期
            laydate.render({
                elem: '#calibrationdatestring',
                value: now,
                btns: ['now', 'confirm'],
                theme: 'molv',
                calendar: true
            });

            //日期
            laydate.render({
                elem: '#submissiondatestring',
                value: now,
                btns: ['now', 'confirm'],
                theme: 'molv',
                calendar: true
            });

            //多图片上传
            upload.render({
                elem: '.uploadNewImg',
                url: '<%=request.getContextPath()%>/rest/equipment/imageProduct',
                multiple: true,
                accept: "images",
                size: 5120,
                before: function (obj) {
                    //预读本地文件示例，不支持ie8
                    obj.preview(function (index, file, result) {
                    });
                },
                done: function (res) {
                    if (res.code == 0) {
                        var image = $("#image").val()
                        if (image == "") {
                            $("#image").val(res.data.imageName)
                        } else {
                            $("#image").val(image + "," + res.data.imageName)
                        }
                        $('#Images').prepend('<li><img layer-src="' + res.data.src + '" src="' + res.data.src + '" class="layui-upload-img" height="253px;" ><div class="operate"><div class="check"><input type="checkbox" name="belle" lay-filter="choose" lay-skin="primary" value="' + res.data.imageName + '" ></div><i class="layui-icon img_del">&#xe640;</i></div></li>')
                        form.render("checkbox");
                    }
                }
                , error: function (index, upload) {
                }
            });

            //删除单张图片
            $("body").on("click", ".img_del", function () {
                var _this = $(this);
                layer.confirm('确定删除图片吗？', {
                    icon: 3,
                    title: '提示信息'
                }, function (index) {
                    _this.parents("li").remove();
                    layer.close(index);
                    var img = _this.siblings().find("input").attr("value")
                    var image = $("#image").val()
                    var ss = image.split(",");
                    ss.remove(img);
                    $("#image").val(ss.toString())
                });
            })

            Array.prototype.remove = function (val) {
                var index = this.indexOf(val);
                if (index > -1) {
                    this.splice(index, 1);
                }
            };

            //全选
            form.on('checkbox(selectAll)', function (data) {
                var child = $("#Images li input[type='checkbox']");
                child.each(function (index, item) {
                    item.checked = data.elem.checked;
                });
                form.render('checkbox');
            });

            //通过判断是否全部选中来确定全选按钮是否选中
            form.on("checkbox(choose)", function (data) {
                var child = $(data.elem).parents('#Images').find('li input[type="checkbox"]');
                var childChecked = $(data.elem).parents('#Images').find('li input[type="checkbox"]:checked');
                if (childChecked.length == child.length) {
                    $(data.elem).parents('#Images').siblings("blockquote").find('input#selectAll').get(0).checked = true;
                } else {
                    $(data.elem).parents('#Images').siblings("blockquote").find('input#selectAll').get(0).checked = false;
                }
                form.render('checkbox');
            })

            //批量删除
            $(".batchDel").click(function () {
                var $checkbox = $('#Images li input[type="checkbox"]');
                var $checked = $('#Images li input[type="checkbox"]:checked');
                if ($checkbox.is(":checked")) {
                    layer.confirm('确定删除选中的图片？', {icon: 3, title: '提示信息'}, function (index) {
                        var index = layer.msg('删除中，请稍候', {icon: 16, time: false, shade: 0.6});
                        setTimeout(function () {
                            //删除数据
                            $checked.each(function () {
                                $(this).parents("li").remove();
                                var img = $(this).attr("value")
                                var image = $("#image").val()
                                var ss = image.split(",");
                                ss.remove(img);
                                $("#image").val(ss.toString())
                            })
                            $('#Images li input[type="checkbox"],#selectAll').prop("checked", false);
                            form.render();
                            layer.close(index);
                            layer.msg("删除成功");
                        }, 2000);
                    })
                } else {
                    layer.msg("请选择需要删除的图片");
                }
            })


            //第一种方法添加用户
            form.on('submit(*)', function (data) {
                var field = data.field//当前容器的全部表单字段，名值对形式：{name: value}
                var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.6});
                $("#pushButton").addClass("layui-btn layui-btn-disabled").prop("disabled", true);
                $.ajax({
                    type: "post",
                    url: "<%=request.getContextPath()%>/rest/equipment/addEquipment",
                    data: field,
                    dataType: "json",
                    async: false,
                    success: function (obj) {
                        setTimeout(function () {
                            layer.close(index);
                            if (obj = true) {
                                layer.msg('添加成功');
                            } else {
                                layer.msg(obj.errorMsg);
                            }
                        }, 2000);
                        setTimeout(function () {
                            var indexs = parent.layer.getFrameIndex(window.name);//获取当前弹出层的层级
                            parent.layer.close(indexs);//关闭弹出层
//                        window.parent.location.reload();//刷新父页面
                        }, 4000);
                    }
                })
                return false;
            });


        });
    }
</script>
</body>
</html>